package cn.jiangjiesheng.bootstrap.commons.utils;

import org.apache.commons.codec.binary.Base64;

/**
 * Created by dev@jiangjiesheng.cn on 2019/12/30.
 */
public class Base64Util {
    /**
     * Base64加密
     *
     * @param key
     * @return
     */
    public static String encode(String key) {
        byte[] bt = key.getBytes();
        return (new Base64().encodeToString(bt));
    }

    /**
     * Baes64解密
     *
     * @param key
     * @return
     */
    public static String decode(String key) {
        byte[] bt = new Base64().decode(key);
        return new String(bt);
    }

}
